#pragma once
#include <map>
#include <stdexcept>
#include <string>

#include "include/play_manager.h"
#include "include/player_state_code.h"
namespace codec {
class PlayerStateBase {
 public:
  virtual ~PlayerStateBase() = default;

  // 状态转换操作
  virtual void setDataSource(PlayManager *manager, int fd) {
    throw std::logic_error("Invalid operation in current state");
  }

  virtual std::map<std::string, std::string> prepare(
      PlayManager *manager, ANativeWindow *window,
      const std::string &vertexCode, const std::string &fragmentCode) {
    throw std::logic_error("Invalid operation in current state");
  }
  virtual void start(PlayManager *manager) {
    throw std::logic_error("Invalid operation in current state");
  }

  virtual void pause(PlayManager *manager) {
    throw std::logic_error("Invalid operation in current state");
  }
  virtual void resume(PlayManager *manager) {
    throw std::logic_error("Invalid operation in current state");
  }

  virtual void stop(PlayManager *manager) {
    throw std::logic_error("Invalid operation in current state");
  }

  virtual void seekTo(PlayManager *manager, float position) {
    throw std::logic_error("Invalid operation in current state");
  }

  virtual void onError(int errorCode) {
    throw std::logic_error("Invalid operation in current state");
  }

  virtual void restart() {
    throw std::logic_error("Invalid operation in current state");
  }

  virtual PlayerStateCode getCode() { return PlayerStateCode::IDLE; }
};
}  // namespace codec